package demo6;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author 24岁没牵过女人的手
 * 日期：2023/9/7 14:44
 * 文件描述：
 */
public class DebugInvocationHandler implements InvocationHandler {

    private final Object target;

    public DebugInvocationHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("send before:"+method.getName());
        Object result = method.invoke(target, args);
        System.out.println("send after:"+method.getName());
        return result;
    }
}
